/******************************************************************************
//             INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//    Copyright(c) 2000 - 2001 Intel Corporation. All Rights Reserved.
//
//  VSS: 
//     $Workfile: $
//     $Revision: $
//     $Date:     $
//     $Archive:  $
//
//  Description:
//      Intel(R) Integrated Performance Primitives - JPEG Helper file.
//      This file contains differential functions for M-JPEG. 
//
//  History:
//     Date         Author        Changes
//     2001/2/1    Jerry Hu       Created (Version 0.2, for M-JPEG)
//
********************************************************************************/
#include "_ippjpeg.h"

#define _FACTOR 0
/******************************************************************************
// Name:             ippiSubBlock_8x8_16s_I
// Description:      Calculate different between two blocks.
// Input Arguments: 
//             pSrc: Identifies source block (1) in 8x8.
//          pSrcDst: Identifies source block (2) in 8x8.
//
// Output Arguments:
//          pSrcDst: Identifies destination block in 8x8.
//                  
// Remarks:      
//                   1. The start address of "pSrc" and "pSrcDst"
//                      shall be aligned at 4byte boundary.
//                   2. It is better to do this alignement at 32byte boundary to optimize 
//                      D-Cache accessing.
//                   
// Returns:         
//    IPP_STATUS_OK: Succeeds.
//
******************************************************************************/
IPPFUN(IppStatus, ippiSubBlock_8x8_16s_I)(Ipp16s *pSrc,
                                          Ipp16s *pSrcDst,
                                          int    nBlockCount)
{
    int i;

    _IPP_CHECK_ARG((NULL!=pSrc)&&(NULL!=pSrcDst));
    _IPP_CHECK_ARG(0<nBlockCount);

    for (i=nBlockCount<<3; i>0; i--) {
        /* 1 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 2 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 3 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 4 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 5 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 6 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 7 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
        /* 8 */
        pSrcDst[0]=(Ipp16s)((pSrcDst[0]-pSrc[0])>>_FACTOR);
        pSrcDst++;
        pSrc++;
    }
    return IPP_STATUS_OK;
}

/******************************************************************************
// Name:             ippiAddBlock_8x8_16s_I
// Description:      Add two blocks
// Input Arguments: 
//             pSrc: Identifies source block (1) in 8x8.
//          pSrcDst: Identifies source block (2) in 8x8.
//
// Output Arguments:
//          pSrcDst: Identifies destination block in 8x8.
//                  
// Remarks:      
//                   1. The start address of "pSrc" and "pSrcDst"
//                      shall be aligned at 4byte boundary.
//                   2. It is better to do this alignement at 32byte boundary to optimize 
//                      D-Cache accessing.
//                   
// Returns:         
//    IPP_STATUS_OK: Succeeds.
//
******************************************************************************/
IPPFUN(IppStatus, ippiAddBlock_8x8_16s_I)(Ipp16s *pSrc,
                                          Ipp16s *pSrcDst,
                                          int    nBlockCount)
{
    int i;

    _IPP_CHECK_ARG((NULL!=pSrc)&&(NULL!=pSrcDst));
    _IPP_CHECK_ARG(0<nBlockCount);

    for (i=nBlockCount<<3; i>0; i--) {
        /* 1 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 2 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 3 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 4 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 5 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 6 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 7 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;
        /* 8 */
        pSrcDst[0]=(Ipp16s)(pSrcDst[0]+(pSrc[0]<<_FACTOR));
        pSrcDst++;
        pSrc++;

    }
    return IPP_STATUS_OK;
}

/* EOF */


